// Account.cpp: implementation of the CAccount class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "log4cplus_switch.h"
#include <string>
#include <list>
#include <map>
#include "SMSItem.h"
#include "SMSDispatch.h"
#include <common/Pool.h>
#include "NETLIB\TCPClient.h"
#include "SMSQueue.h"
#include "AccountManager.h"
#include "IF.h"
#include "IFManager.h"
#include "netlib/SocketEngine.h"
#include "SMSApp.h"
#include "Account.h"

LOG4CPLUS_CLASS_IMPLEMENT( CAccount, _s_logger, "CAccount" );

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CAccount::CAccount()
{
    m_SMSQueue.SetParent(this);
}

CAccount::~CAccount()
{

}

void CAccount::SubmitSMS(CSMSItem* pSMS)
{
    m_SMSQueue.SubmitSMS(pSMS);
}

BOOL CAccount::SendOutByIF(CSMSItem* pSMS)
{
	//find an active Interface by IFManager and send out
	return CSMSApp::GetInstance()->m_IFManager.SendOut(this, pSMS);
	//after success sent return a seq no
}

BOOL CAccount::AddInterface(int protocol, const char *destIP, unsigned short port)
{
    return FALSE;
}

void CAccount::PeriodDispatch()
{
   m_SMSQueue.SendOut();
}

void CAccount::OnReceive(CSMSItem *pSMS)
{
    //receive SUBMIT,SUBMITRESP,DELIVER,DELIVER_RESP
}
